import { ajaxAsync } from 'vue-xiaobu-utils'
/**
 * 取消订单
 * @param {String} orderNo 订单编号
 */

async function closeOrder(orderNo) {
  let sendObj = {
    ORDER_ID: orderNo
  }
  let res = await ajaxAsync('order/close', sendObj)
  return res
}

/**
 * 删除订单
 * @param {String} orderNo 订单编号
 */

function deleteOrder(orderNo) {
  let sendObj = {
    ORDER_ID: orderNo
  }
  return ajaxAsync('order/delete', sendObj)
}

/**
 * 获取订单支付支付串
 * @param {String} orderNo 订单编号
 * @param {String} payment 支付方式
 */

async function paymentOrder(orderNo, payment) {
  let sendObj = {
    ORDER_ID: orderNo,
    PAYMENT: payment
  }
  let res = await ajaxAsync('order/payment', sendObj)
  return res
}

export { closeOrder, deleteOrder, paymentOrder }
